package com.hzdh.account.controller.account;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hzdh.account.commom.validate.AjaxResponse;
import com.hzdh.account.controller.account.AccountListController;
import com.hzdh.account.request.goods.ToAccountDetailRequest;
import com.hzdh.account.request.goods.ToAccountHzRequest;
import com.hzdh.account.request.goods.ToGoodsRequest;
import com.hzdh.account.service.GoodsAccountService;

@Controller
@RequestMapping("account")
public class AccountGoodsController {

	private static Logger logger = LoggerFactory.getLogger(AccountListController.class);

	@Autowired
	private GoodsAccountService goodsAccountService;
	
	@ResponseBody
	@RequestMapping("goods/save")
	public AjaxResponse accountSave(ToAccountDetailRequest accountDetailRequest, ToAccountHzRequest accountHzRequest, ToGoodsRequest goodsRequest) {
		AjaxResponse res = new AjaxResponse();
		try {
			goodsAccountService.save(accountDetailRequest, accountHzRequest, goodsRequest);
			res.success();
		} catch (Exception e) {
			e.getStackTrace();
			logger.info("", e.getStackTrace());
			res.setContent("保存流水账户信息异常!");
			res.fail();
		}
		return res;
	}
}
